package com.iot.ic.service;



import com.iot.ic.dao.StadiumInfoMapper;
import com.iot.ic.model.IllegalInfo;
import com.iot.ic.model.MatchScenesInfo;
import com.iot.ic.model.StadiumInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by xiuge on 2017/2/20.
 */
@Service
public class StadiumServiceImpl implements StadiumService {

	@Autowired
	private StadiumInfoMapper stadiumInfoMapper;
	
	@Autowired
	private MatchScenesService matchScenesService;
	
	@Autowired
	private IllegalService illegalService;

	@Override
	public List<StadiumInfo> listStadiumInfos(StadiumInfo stadiumInfo) {
		List<StadiumInfo> result = stadiumInfoMapper.listStadiumInfos(stadiumInfo);
		return result;
	}

	@Override
	public int addStadiumInfos(StadiumInfo stadiumInfo) {
		int result = stadiumInfoMapper.insert(stadiumInfo);
		return result;
	}

	@Override
	public int updateStadiumInfo(StadiumInfo stadiumInfo) {
		int result = stadiumInfoMapper.updateByPrimaryKeySelective(stadiumInfo);
		return result;
	}

	@Override
	public int deleteStadiumInfo(int stadiumInfoId) {
		int result = stadiumInfoMapper.deleteStadiumInfo(stadiumInfoId);
		return result;
	}

	@Override
	public StadiumInfo getStadiumInfoWithSceneList(int stadiumInfoId) {
		StadiumInfo stadiumInfo = stadiumInfoMapper.selectByPrimaryKey(stadiumInfoId);
		List<MatchScenesInfo> matchScenesInfoList = matchScenesService.listScenesByStadium(stadiumInfoId);
		stadiumInfo.setScenesInfoList(matchScenesInfoList);
		return stadiumInfo;
	}

	@Override
	public StadiumInfo getStadiumPosition(int stadiumInfoId) {
		StadiumInfo stadiumInfo = stadiumInfoMapper.getStadiumPosition(stadiumInfoId);
		return stadiumInfo;
	}
}
